Auto merge of #1557 - alexcrichton:exhaustive, r=brson
authorbors <bors@rust-lang.org>
Wed, 29 Apr 2015 18:35:16 +0000 (18:35 +0000)
committerbors <bors@rust-lang.org>
Wed, 29 Apr 2015 18:35:16 +0000 (18:35 +0000)
This commit fills out the functionality of `--lib`, `--test`, `--bin`,
`--bench`, and `--example` for the `cargo {test,build,bench}` commands all at
once. The support for all of this was introduced long ago, and the flags just
weren't exposed at the time.

1  2 
src/bin/test.rs

diff --cc src/bin/test.rs
index 85251624b87c61df6a6f812fa6183839db2afe15,d46b67d44aa926c56ec39c585eb0556e20695d6c..f7a7ba55572e6b121dc571d2c3f905e03bfa121f
@@@ -14,8 -12,12 +12,13 @@@ struct Options 
      flag_no_run: bool,
      flag_package: Option<String>,
      flag_target: Option<String>,
+     flag_lib: bool,
+     flag_bin: Vec<String>,
+     flag_example: Vec<String>,
+     flag_test: Vec<String>,
+     flag_bench: Vec<String>,
      flag_verbose: bool,
 +    flag_release: bool,
  }
  
  pub const USAGE: &'static str = "
@@@ -74,16 -70,13 +72,13 @@@ pub fn execute(options: Options, config
              no_default_features: options.flag_no_default_features,
              spec: options.flag_package.as_ref().map(|s| &s[..]),
              exec_engine: None,
 -            release: false,
 +            release: options.flag_release,
              mode: ops::CompileMode::Test,
-             filter: if tests.is_empty() && bins.is_empty() {
-                 ops::CompileFilter::Everything
-             } else {
-                 ops::CompileFilter::Only {
-                     lib: false, examples: &[], benches: &[],
-                     tests: &tests, bins: &bins,
-                 }
-             }
+             filter: ops::CompileFilter::new(options.flag_lib,
+                                             &options.flag_bin,
+                                             &options.flag_test,
+                                             &options.flag_example,
+                                             &options.flag_bench),
          },
      };